Skip to content

๐Ÿš€ 2๋‹จ๊ณ„ - ๋ฆฌํŒฉํ„ฐ๋ง(๋ฉ”๋‰ด)#372

Open
AlbertImKr wants to merge 6 commits intonext-step:albertimkrfrom
AlbertImKr:step2
Open

๐Ÿš€ 2๋‹จ๊ณ„ - ๋ฆฌํŒฉํ„ฐ๋ง(๋ฉ”๋‰ด)#372
AlbertImKr wants to merge 6 commits intonext-step:albertimkrfrom
AlbertImKr:step2

Conversation

@AlbertImKr
Copy link

๋ฆฌ๋ทฐ์–ด๋‹˜ ์•ˆ๋…•ํ•˜์„ธ์š”

2๋‹จ๊ณ„ ๋ฉ”๋‰ด ๋ฆฌํŒฉํ„ฐ๋ง ๊ณผ์ œ ์ œ์ถœํ•ฉ๋‹ˆ๋‹ค.

๋ฆฌ๋ทฐ ์š”์ฒญ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

์ข‹์€ ํ•˜๋ฃจ ๋ณด๋‚ด์„ธ์š”~

Copy link

@sah3122 sah3122 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ฐœ์ธ์ ์ธ ์‚ฌ์ •์œผ๋กœ ์ธํ•ด ๋ณ‘์›์— ์ž…์›ํ•˜๊ฒŒ ๋˜์–ด ๋ฆฌ๋ทฐ๊ฐ€ ๋Šฆ์–ด์กŒ์Šต๋‹ˆ๋‹ค ๐Ÿ™
๋ฉ”๋‰ด ๋ฆฌํŒฉํ„ฐ๋ง ๊ตฌํ˜„ ์ž˜ํ•ด์ฃผ์…จ๋„ค์š” ๐Ÿ˜„
๋ช‡๊ฐ€์ง€ ์ƒ๊ฐ๊ฑฐ๋ฆฌ๋ฅผ ๋‚จ๊ฒจ๋‘์—ˆ๋Š”๋ฐ ํ™•์ธ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค!

columnDefinition = "binary(16)",
foreignKey = @ForeignKey(name = "fk_menu_to_menu_group")
)
private MenuGroup menuGroup;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MenuGroup์„ ์ง์ ‘ ์ฐธ์กฐ๋กœ ๊ตฌํ˜„ํ•ด์ฃผ์‹  ์ด์œ ๊ฐ€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค ๐Ÿ˜„

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ•œ Context์•ˆ์— ์กด์žฌํ•˜์—ฌ ๋งŒ์•ฝ์— Id๋กœ ์ฐธ์กฐํ•˜๋ฉด ์˜คํžˆ๋ ค ๋” ๋ณต์žกํ•œ ๊ตฌ์กฐ๊ฐ€ ๋  ์ˆ˜ ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ์–ด์š”,

return id;
}

public void changePrice(MenuPrice price) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ˜„์žฌ domain ๊ฐ์ฒด๊ฐ€ ๋ฉ”๋‰ด ๊ฐ€๊ฒฉ ๋ณ€๊ฒฝ์— ๋Œ€ํ•œ ์š”๊ตฌ์‚ฌํ•ญ์„ ํ•ญ์ƒ ๋งŒ์กฑํ• ์ˆ˜์žˆ์„๊นŒ์š” ?
domain ๊ฐ์ฒด๋งŒ์œผ๋กœ ๋ชจ๋“  ์š”๊ตฌ์‚ฌํ•ญ์„ ๋งŒ์กฑํ• ์ˆ˜ ์žˆ๋„๋ก ๊ตฌํ˜„ํ•ด๋ณด์„ธ์š” ๐Ÿ˜„
๋‹ค๋ฅธ ํ–‰์œ„๋„ ํ™•์ธ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค !

private final MenuRepository menuRepository;
private final MenuGroupService menuGroupService;
private final PurgomalumClient purgomalumClient;
private final MenuProductService menuProductService;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Application Service ๊ฐ„์˜ ๊ฒฐํ•ฉ์ด ๋ฐœ์ƒํ•˜๋ฉด ์–ด๋–ค ๋ฌธ์ œ์ ์ด ์žˆ์„๊นŒ์š” ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ œ๊ฐ€ ์ƒ๊ฐํ•˜๋Š” Application Service ๊ฐ„์˜ ๊ฒฐํ•ฉ์ด ๋ฐœ์ƒํ•  ๋•Œ ๋‚˜ํƒ€๋‚  ์ˆ˜ ์žˆ๋Š” ๋ฌธ์ œ์ ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  1. ์ˆœํ™˜ ์ฐธ์กฐ์™€ ๋ณต์žก์„ฑ ์ฆ๊ฐ€๊ฐ€ ์ฃผ์š” ์ด์Šˆ์ž…๋‹ˆ๋‹ค.
  2. ํ•˜์ง€๋งŒ ์ €๋Š” MenuGroup์ด Menu์˜ ์ˆœํ•˜์œ„ ๋„๋ฉ”์ธ์ด๊ธฐ ๋•Œ๋ฌธ์— ์‹ค์ œ๋กœ ํฐ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š์„ ๊ฒƒ์ด๋ผ๊ณ  ํŒ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค.
  3. ๊ทธ๋Ÿผ์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ  ์„œ๋น„์Šค ๊ฐ„ ์ฑ…์ž„์„ ๋ช…ํ™•ํžˆ ๋ถ„๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด Facade ํŒจํ„ด์„ ์ ์šฉํ•˜์—ฌ ์„œ๋น„์Šค์˜ ์—ญํ• ์„ ๋ถ„๋ฆฌํ–ˆ์Šต๋‹ˆ๋‹ค.

public Menu create(final MenuCreateRequest request) {
final MenuPrice price = new MenuPrice(request.price());
final MenuGroup menuGroup = menuGroupService.findById(request.menuGroupId());
final List<MenuProduct> menuProducts = menuProductService.getMenuProducts(price, request.menuProducts(), request.productIds());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

menuProductService ๋ฅผ ํ†ตํ•˜์—ฌ menuproduct ๋ฅผ ๊ฐ€์ง€๊ณ  ์˜จ ์ด์œ ๊ฐ€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค !

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Menu Context ์ž์ฒด์—์„œ๋Š” Product๋ฅผ ์ง์ ‘ ์ฐธ์กฐํ•˜์ง€ ์•Š์ง€๋งŒ Product ์ •๋ณด๋ฅผ ํ™•์ธํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ์œ„ํ•ด ํ•˜์œ„ ๋„๋ฉ”์ธ์ธ MenuProduct์—์„œ Product๋ฅผ ์กฐํšŒํ•˜๋„๋ก ์„ค๊ณ„ํ–ˆ์Šต๋‹ˆ๋‹ค.

@AlbertImKr
Copy link
Author

๋ฉ˜ํ† ๋‹˜ ์ž˜ ์ง€๋‚ด๊ณ  ๊ณ„์‹ ๊ฐ€์š”?

ํ”ผ๋“œ๋ฐฑ ์ ์šฉํ•œ PR ๋งŽ์ด ๋Šฆ์—ˆ์Šต๋‹ˆ๋‹ค.
๊ทธ๋ž˜๋„ ๋ฆฌ๋ทฐ ์š”์ฒญ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ๐Ÿ˜Š

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants